package cloudoer.su.service.impl;

import cloudoer.su.base.impl.BaseServiceImpl;
import cloudoer.su.entity.Person;
import cloudoer.su.service.PersonService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("personService")
@Transactional
public class PersonServiceImpl extends BaseServiceImpl implements PersonService {
    public List<Person> getAll(String q) {
        if (StringUtils.isNotBlank(q)){
            return personDao.getByLikeName(q);
        }
        return personDao.getAll();
    }

    public List<Person> getByPage(int pageNo, int pageSize) {
        return personDao.getByPage(pageNo,pageSize);
    }

    public Person getById(String id) {
        return (Person) personDao.getById(id);
    }

    public Person getByNumber(String number) {
        return (Person) personDao.getByNumber(number);
    }

    public int getCount() {
        return personDao.getCount();
    }
}
